package com.haojin.spring.resources;

import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.core.io.Resource;

/**
 * @author .29.
 * @create 2023-03-02 21:41
 */
public class Demo {
    public static void main(String[] args) {
        /*
         * 通过搜索文件系统路径下的xml文件创建ApplicationContext，
         * 但通过指定classpath:前缀强制搜索类加载路径
         * classpath:bean.xml
         * */
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("classPath:bean.xml");
        Resource resource = context.getResource("baidu.txt");
        System.out.println(resource.getFilename());
        System.out.println(resource.getDescription());
    }
}
